﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
//using JoeResume.Data;
//using JoeResume.Data.Repository;
using JoeResume.Model;
using JoeResume2.Data;
using Newtonsoft.Json.Serialization;

namespace JoeResume.Web.Controllers
{
    public class ResumeController : ApiController
    {
        private IUnitOfWork _unitOfWork;
        //private readonly IRepository<Resume> _repository;
        //private IShowMessage _showMessage;

        public ResumeController(IUnitOfWork unitOfWork)
        {
            _unitOfWork = unitOfWork;
        }
        //public ResumeController()
        //{
        //    _repository = new ResumeRepository(new ResumeDbContext());
        //}
        //public ResumeController(IRepository<Resume> repository)
        //{
        //    _repository = repository;
        //}
        //public ResumeController(IShowMessage showMessage)
        //{
        //    _showMessage = showMessage;
        //}

        [HttpGet]
        public HttpResponseMessage Get()
        {
            //var sMsg = _showMessage.Show();
            var repository = _unitOfWork.ResumeRepository; 
            var resumes = repository.GetAll().ToArray();

            HttpResponseMessage msg = null;
            
            //msg = Request.CreateResponse<Resume[]>(HttpStatusCode.OK, resumes);
            msg = Request.CreateResponse(HttpStatusCode.OK);
            return msg;
        }
        
        [HttpPost]
        public void InsertResume([FromBody]Resume resume)
        {
            HttpResponseMessage msg = null;
            //msg = Request.CreateResponse(HttpStatusCode.OK);
            //return msg;
        }
    }
}
